<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=7" />
	<title>“半价汇”广告管理系统</title>
	<!-- Reset Stylesheet -->
	<link rel="stylesheet" href="static/css/reset.css" type="text/css" media="screen" />
  
	<!-- Main Stylesheet -->
	<link rel="stylesheet" href="static/css/style.css" type="text/css" media="screen" />
	
	<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
	<link rel="stylesheet" href="static/css/invalid.css" type="text/css" media="screen" />	
	<script type="text/javascript" src="static/js/jquery.min.js"></script>
	<!-- jQuery Configuration -->
	<script type="text/javascript" src="static/js/simpla.jquery.configuration.js"></script>
	<script type="text/javascript" src="static/js/date.js"></script>
	<script type="text/javascript" src="static/js/jquery.datePicker.js"></script>
</head>
<body>
	<div id="body-wrapper">
		<?php include 'admin_sidebar.html'; ?>
		<div id="main-content">
			<div class="content-box">
				<div class="content-box-header">
					<h3>广告列表</h3>
					<div class="clear"></div>
				</div> <!-- End .content-box-header -->
				
				<div class="content-box-content">
						<table>
							<thead>
							<tr>
								<td colspan="6">
									<div class="bulk-actions align-left">
										<form action="<?php echo spUrl('admin', 'search');?>" method="get" >
										<input type="hidden" name="c" value="admin">
										<input type="hidden" name="a" value="search">
										<input type="text" name="title" value="<?php if($title) {echo $title;} else { echo '活动名称';} ?>" onfocus="if(this.value=='活动名称') {this.value='';$(this).attr('style', 'color:#000')};" <?php if(!$title) {?>style="color:#ccc;"<? } ?>>
										<input type="submit" name="dosubmit" value="Go" class="button"/>
										<?php if(!$store_id) { ?> 
										<a href="<?php echo spUrl('admin', 'search', array('enddate'=>date("Y-m-d", time())));?>" class="button">明日过期活动</a>
										<a href="<?php echo spUrl('admin', 'todaylist');?>" class="button">今日新上活动</a>
										<?php } ?>
										</form>
									</div>
								</td>
							</tr>
							<tr>
								<th width="6%">排序</th>
								<th width="20%">名称</th>
								<th>起止时间</th>
								<th>链接</th>
								<th width="8%">点击数</th>
								<th width="10%">操作</th>
							</tr>
							</thead>
							<form action="<?php echo spUrl('admin', 'listorder');?>" method="post">
							<?php foreach($results as $k=>$v) { ?>
							<tr>
								<td align="center"><input type="text" name="listorder[<?php echo $v['pid'];?>]" value="<?php echo $v['listorder']; ?>" size="1" maxlength="5" /></td>
								<td align="center"><?php echo $v['title'];?></td>
								<td align="center"><?php echo $v['startdate'];?><br />~<br /><?php echo $v['enddate'];?></td>
								<td align="center"><a href="<?php echo $v['url'];?>" target="_blank"><?php echo substr($v['url'], 0, 100);?></a></td>
								<th><?php echo $v[nums]; ?></th>
								<td align="center">
									<a href="<?php echo spUrl('stat', 'history_pid', array('pid'=>$v['pid']));?>">历史记录</a><br />
									<a href="<?php echo spUrl('admin', 'edit', array('pid'=>$v['pid']));?>"><img src="static/images/icons/pencil.png" alt="修改"  title="修改"/></a>
									<?php if($v['status'] == 0) {?>
									<a href="<?php echo spUrl('admin', 'status', array('pid'=>$v['pid'], 'set'=>1));?>"><img src="static/images/icons/cross_circle.png" alt="禁用"  title="禁用"/></a>
									<?php } else { ?>
									<a href="<?php echo spUrl('admin', 'status', array('pid'=>$v['pid'], 'set'=>0));?>"><img src="static/images/icons/tick_circle.png" alt="启用" title="启用" /></a>
									<?php } ?>
									<a href="###" onclick="if(confirm('是否删除该广告')) location='<?php echo spUrl('admin', 'del', array('pid'=>$v['pid'], 'del'=>1));?>'"><img src="static/images/icons/cross.png" title="删除" alt="删除" /></a><BR />
									<a href="<?php echo spUrl('admin', 'get_also_bought', array('pid'=>$v['pid']));?>" title="看过该商铺的用户还看过">Relate(Beta)</a>
								</td>
							</tr>
							<?php } ?>
							<tfoot>
								<tr>
									<td colspan="6">
									<div class="bulk-actions align-left">
										<input type="submit" name="dosubmit" value="排序" class="button"/>
										<?php if($store_id) { ?><a href="<?php echo spUrl('admin', 'post', array('store_id'=>$store_id));?>" class="button">添加店铺</a><?php } ?>
									</div>
									<div class="pagination">
										<div class="page-bottom tp">
											<?php if($pager[current_page] == $pager[first_page]) {?>
											<span class="page-start"><span><b class="icon"></b>上一页</span></span>
											<?php } else { ?>
											<a href="<?php echo spUrl('admin', $a, array('page'=>$pager[prev_page])); ?>" class="page-prev"><b class="icon"></b>上一页</a>
											<?php } ?>
											<?php foreach($pager[all_pages] as $thepage) {?>
											<?php if($thepage == $pager[current_page]) {?>
											<span class="page-cur"><?php echo $thepage; ?></span>
											<?php } else { ?>
											<a href="<?php echo spUrl('admin', $a,  array('page'=>$thepage)); ?>" class="number"><?php echo $thepage; ?></a>
											<?php }} ?>
											<?php if($pager[current_page] == $pager[last_page]) {?>
											<span class="page-end"><b class="icon"></b>下一页</span>
											<?php } else { ?>
											<a href="<?php echo spUrl('admin', $a, array('page'=>$pager[next_page])); ?>" class="page-next">下一页<b class="icon"></b></a>
											<?php } ?>
										</div>
									</div>
									<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
</script>
</html>